using System;
using UnityEngine;

namespace LightingUtil
{
    [Serializable]
    public class LightmapProxy
    {
        [SerializeField] private Texture2D light;
        [SerializeField] private Texture2D dir;
        [SerializeField] private Texture2D shadowMask;

        private LightmapData _lightmapData;


        public LightmapProxy(LightmapData lightmapData)
        {
            light = lightmapData.lightmapColor;
            dir = lightmapData.lightmapDir;
            shadowMask = lightmapData.shadowMask;
        }

        public LightmapData GetLightmap()
        {
            if (_lightmapData != null)
                return _lightmapData;
            _lightmapData = new LightmapData
            {
                lightmapColor = light,
                lightmapDir = dir,
                shadowMask = shadowMask
            };
            return _lightmapData;
        }
    }
}